@extends('layouts.app')

@section('title',$user->name.'的个人空间')

@section('content')
    <div class="row">
        <div class="col-md-3">
            <div class="card">
                @include('shared._avatar',['avatar'=>$user->avatar,'is_border'=>'hidden'])
                <div class="card-body">
                    <hr>
                    <h5 class="text-center text-muted">
                        <i class="fa-solid fa-user-tie"></i>
                        用户名
                    </h5>
                    <h4 class="text-center text-success">{{$user->name}}</h4>
                    <hr>
                    <h5 class="text-center text-muted">
                        <i class="fa-solid fa-clipboard"></i>
                        用户简介
                    </h5>
                    <h4 class="text-center text-success">
                       {{$user->introduction}}
                    </h4>
                    <hr>
                    <h5 class="text-center text-muted">
                        <i class="fa-brands fa-gripfire"></i>
                        最后登录时间
                    </h5>
                    <h4 class="text-center text-success">{{$user->last_actived_at->diffForHumans()}}</h4>
                    <hr>
                    <h5 class="text-center text-muted">
                        <i class="fa-regular fa-clock"></i>
                        注册时间
                    </h5>
                    <h4 class="text-center text-success">{{$user->created_at->diffForHumans()}}</h4>
                </div>
            </div>
        </div>
        <div class="col-md-9">
            <div class="card">
                <div class="card-body">
                    <h1>{{$user->name}} -- <small>{{$user->email}}</small></h1>
                </div>
            </div>
            <div class="card mt-2">
            <div class="card-body">
                <ul class="nav nav-tabs">
                    <li class="nav-item">
                        <a class="nav-link {{active_class(if_query('tab',null))}}" aria-current="page" href="{{route('users.show',$user->id)}}">TA的帖子</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link {{active_class(if_query('tab','replies'))}}" href="{{route('users.show',[$user->id,'tab'=>'replies'])}}">TA的评论</a>
                    </li>
                </ul>
                @if(if_query('tab','replies'))
                    @include('users._replies',['replies'=>$user->replies()->with('topic')->recent()->paginate(20)])
                @else
                    @include('users._topics',['topics'=>$user->topics()->recent()->paginate(8)])
                @endif

            </div>
        </div>
        </div>
    </div>
@stop
